﻿using ExitGames.Client.Photon;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Common;
public class RegisterRequest : Request
{
    [HideInInspector]
    public string Username;
    [HideInInspector]
    public string Password;

    public override void DefaultRequest()
    {
        Dictionary<byte, object> data = new Dictionary<byte, object>();
        data.Add((byte)ParameterCode.Username, Username);
        data.Add((byte)ParameterCode.Password, Password);
        PhotonServerManager.peer.OpCustom((byte)opCode, data, true);
    }

    public override void OnOperationReponse(OperationResponse operationResponse)
    {
        if (operationResponse.ReturnCode == (short)ReturnCode.Success)
        {
            Debug.Log("注册成功");
        }
        else
        {
            Debug.Log("注册失败");
        }
    }

    void Start()
    {
        PhotonServerManager.Instance.AddRequest(this);
    }

    private void OnDestroy()
    {
        PhotonServerManager.Instance.RemoveRequest(this);
    }
}
